<extend name="Base/common"/>
<block name="body">
    <div class="p">
        <center>
            用户登录
        </center>
    </div>
    <center>
        <div class='text-center DataImg'><img id="im" class='img-rounded' width="100" style='' src='__MAST_HOME__/picture/user.png'>
        </div>
    </center>
    <div class="aui-card ">
        <div class="aui-form">
            <div class="aui-input-row"><i class="aui-input-addon  aui-iconfont aui-icon-people"></i>
                <input id="UserName" type="text" name="username" class="aui-input" onclick="butu()" placeholder="用户名/手机号"/>
                <i id="Clu" class="aui-input-addon  aui-iconfont aui-icon-close" onclick="ClearU()"></i></div>
            <div class="aui-input-row"><i class="aui-input-addon  aui-iconfont aui-icon-lock"></i>
                <input id="UserPass" type="password" name="password" class="aui-input" onclick="butp()" placeholder="密码"/>
                <i id="Clp" class="aui-input-addon  aui-iconfont aui-icon-close" onclick="ClearP()"></i></div>
        </div>
    </div>
    <div class="pp">
        <p>
            <button type="submit" class="aui-btn aui-btn-success aui-btn-block" id="butm" tapmode>登陆</button>
        </p>
    </div>
    <div class="pp">
        <input type="checkbox" id="ck_rmbUser"/>
        记住用户名和密码 <span class="pull-right"><a class="col-xs-12 aui-text-center" href="">忘记密码</a></span></div>
</block>
<block name="script">
    <script type="text/javascript">
        var str = location.href;
        if (str.indexOf("www.78mei.net") != -1) {

        }
        else {
            if (localStorage.UId == undefined || localStorage.UId == "" || localStorage.UId == null) {

            }
            else {
                var str = location.href;
                if (str.indexOf("?") != -1) {
                    if (str.split("?")[1] == "1") {

                        location.href = "shop.html";

                    }
                }
                else {
                    location.href = "UserCenter.html";
                }
            }

            function show() {
                var loading = $api.dom(".aui-loading");
                if (!loading) {
                    $api.append($api.dom('body'), '<div class="aui-loading"><div class="aui-loading-1"></div><div class="aui-loading-2"></div></div>');
                }
            }
            var UserName = $('#UserName');
            var UserPass = $('#UserPass');
            $("#Clu").hide();
            $("#Clp").hide();
            function butu() {
                $("#Clu").show();
            }
            function butp() {
                $("#Clp").show();
            }
            function ClearU() {
                UserName.val('').focus();
                $("#Clu").hide();
            }
            function ClearP() {
                UserPass.val('').focus();
                $("#Clp").hide();
            }
        }
    </script>
    <script type="text/javascript">
        $("#butm").click(function(){
            var username=$("input[name='username']").val();
            var password=$("input[name='password']").val();
           if(!username){
               layer.msg('请填写用户名或手机号码');
           }
            if(!password){
                layer.msg('请填写密码');
            }
            $.ajax({
                type:"POST",
                url:"{:U('User/login')}",
                data:{username:username,password:password},
                dataType:"json",
                success:function(data){
                   if(data.status==1){
                       layer.msg('登陆成功,正在跳转');
                       location.href = data.url;
                   }else{
                       layer.msg(data.info);
                   }
                }
            })
        })
    </script>
</block>
